package com.ruoyi.douyin.controller.open;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.douyin.service.open.UserOpenDataService;
import com.ruoyi.douyin.vo.UserOpenDataVideoDataVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/douyin/open/data/user")
public class UserOpenData {

    @Autowired
    private UserOpenDataService userOpenDataService;

    @PostMapping("/all/data")
    public AjaxResult getAll(@RequestBody UserOpenDataVideoDataVo userOpenDataVideoDataVo) {
        return userOpenDataService.getAll(userOpenDataVideoDataVo);
    }

    /**
     * 获取用户视频情况
     *
     * @param userOpenDataVideoDataVo OpenId 数据类新
     */
    @PostMapping("/video")
    public AjaxResult videoData(@RequestBody UserOpenDataVideoDataVo userOpenDataVideoDataVo) {
        return userOpenDataService.videoData(userOpenDataVideoDataVo, "video");
    }

    /**
     * 获取用户粉丝数
     *
     * @param userOpenDataVideoDataVo OpenId 数据类新
     */
    @PostMapping("/fans")
    public AjaxResult fansData(@RequestBody UserOpenDataVideoDataVo userOpenDataVideoDataVo) {
        return userOpenDataService.videoData(userOpenDataVideoDataVo, "fans");
    }

    /**
     * 获取用户点赞数
     *
     * @param userOpenDataVideoDataVo OpenId 数据类新
     */
    @PostMapping("/like")
    public AjaxResult likeData(@RequestBody UserOpenDataVideoDataVo userOpenDataVideoDataVo) {
        return userOpenDataService.videoData(userOpenDataVideoDataVo, "like");
    }

    /**
     * 获取用户评论数
     *
     * @param userOpenDataVideoDataVo OpenId 数据类新
     */
    @PostMapping("/comment")
    public AjaxResult commentData(@RequestBody UserOpenDataVideoDataVo userOpenDataVideoDataVo) {
        return userOpenDataService.videoData(userOpenDataVideoDataVo, "comment");
    }

    /**
     * 获取用户分享数
     *
     * @param userOpenDataVideoDataVo OpenId 数据类新
     */
    @PostMapping("/share")
    public AjaxResult shareData(@RequestBody UserOpenDataVideoDataVo userOpenDataVideoDataVo) {
        return userOpenDataService.videoData(userOpenDataVideoDataVo, "share");
    }

    /**
     * 获取用户主页数
     *
     * @param userOpenDataVideoDataVo OpenId 数据类新
     */
    @PostMapping("/index")
    public AjaxResult indexData(@RequestBody UserOpenDataVideoDataVo userOpenDataVideoDataVo) {
        return userOpenDataService.videoData(userOpenDataVideoDataVo, "index");
    }
}
